//
//  ShippingViewController.m
//  JieYing
//
//  Created by CJX on 16/8/30.
//  Copyright © 2016年 Shanghai DuRui Information Technology Company. All rights reserved.
//

#import "ShippingViewController.h"

@interface ShippingViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,copy) NSString * str;
@end

@implementation ShippingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.automaticallyAdjustsScrollViewInsets = NO;

    [self makeNaviButton];
    [self makeView];
}
-(void)makeView{
    UITableView * tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, KScreenWidth, KScreenHeight) style:UITableViewStylePlain];
    UIImageView *imageview = [[UIImageView alloc]init];
    
    if (KScreenWidth == 320) {
        imageview.frame = CGRectMake(10, 0, KScreenWidth-20, 2479);
    }else if(KScreenWidth >320&& KScreenWidth < 400){
        imageview.frame = CGRectMake(10, 0, KScreenWidth-20, 2933);
    }else{
        imageview.frame = CGRectMake(10, 0, KScreenWidth-20, 3256);
    }
    
    imageview.image = [UIImage imageNamed:@"biaoge"];
    self.view.backgroundColor=[UIColor whiteColor];
    tableView.delegate = self;
    tableView.dataSource = self;
    
    [tableView addSubview:imageview];
    [self.view addSubview:tableView];
    
    
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        
        
    }
    UILabel *contactLabel=[[UILabel alloc]init];
    contactLabel.text=_str;
    contactLabel.numberOfLines=0;
    [cell addSubview:contactLabel];
    if (KScreenWidth == 320) {
        contactLabel.frame = CGRectMake(20, 5, KScreenWidth, 568 +200);
    }else if(KScreenWidth >320&& KScreenWidth < 400){
        contactLabel.frame = CGRectMake(20, 5, KScreenWidth, KScreenHeight);
    }
    else{
        contactLabel.frame = CGRectMake(20, 0, KScreenWidth, KScreenHeight - 80);
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (KScreenWidth == 320) {
        return 2579;
    }else if(KScreenWidth >320&& KScreenWidth < 400){
        return 3033;
    }else{
        return 3356;
    }
    
}
-(void)makeNaviButton{
    
    self.title=@"SHIPPING POLICY";
    
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [leftButton setBackgroundImage:[UIImage imageNamed:@"nav_back"] forState:0];
    
    leftButton.frame=CGRectMake(0, 0, ACTUAL_WIDTH(23), ACTUAL_HEIGHT(23));
    
    [leftButton addTarget:self action:@selector(comeBack) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem*item= [[UIBarButtonItem alloc]initWithCustomView:leftButton];
    
    self.navigationItem.leftBarButtonItem=item;
}
#pragma mark 返回事件
-(void)comeBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
